const baseUrl = 'http://127.0.0.1:8090/api'   
const request = (url = '', type='GET',data = {},params={}) => {
	let isFirst = true;
	for(const key in params){
		if(isFirst) url+='?'+`${key}`+'='+`${params[key]}`,isFirst=false;
		else url+='&'+`${key}`+'='+`${params[key]}`;
	}
	console.log(url);
    return new Promise((resolve, reject) => {
        uni.request({
            method: type,
            url: baseUrl + url,
            data: data,
            header:{
				"satoken": uni.getStorageSync('tokenValue')
			},
            dataType: 'json',
			success: (response) =>{
				resolve(response);
			},
			fail:(error) =>{
				console.log(error)
				reject(error);
			}
        })
    });
}
export default request